When reparenting, remove from old parent before setting the new parent
authorAlexander Larsson <alexl@redhat.com>
Sun, 7 Dec 2008 12:42:19 +0000 (13:42 +0100)
committerAlexander Larsson <alex@localhost.localdomain>
Thu, 2 Apr 2009 08:14:07 +0000 (10:14 +0200)
(otherwise we remove from the wrong parent)

gdk/gdkwindow.c

index 381ce0de94ff987cd739de7aaa995be556c9f178..a95d69b0d030e42f4dd4fcff810d345d664dfdbf 100644 (file)
@@ -973,13 +973,13 @@ gdk_window_reparent (GdkWindow *window,
       new_parent_private = (GdkWindowObject *)new_parent;
     }
 
+  if (private->parent)
+    private->parent->children = g_list_remove (private->parent->children, window);
+  
   private->parent = new_parent_private;
   private->x = x;
   private->y = y;
 
-  if (private->parent)
-    private->parent->children = g_list_remove (private->parent->children, window);
-  
   new_parent_private->children = g_list_prepend (new_parent_private->children, window);
   
   /* Switch the window type as appropriate */